package gamer;

import java.awt.Color;

import battlestein.BattleWar;
import dispatcher.InterfaceDispatcher;
/**
 * 
 * @author LocoRocoBattleStein
 *
 */
public abstract class Gamer {

	protected InterfaceDispatcher dp;
	protected BattleWar bw;
	protected int id;
	protected Color color;
	protected int money;
	protected String pseudo;
	/**
	 * Constructor
	 * @param id
	 * @param pseudo
	 * @param dp
	 */
	public Gamer(int id, String pseudo, InterfaceDispatcher dp) {
		this.id = id;
		this.pseudo = pseudo;
		this.bw = new BattleWar();
		this.money = 10000;
		switch(id) {
		case 1 :
			this.color = Color.BLUE;
			break;
		case 2 :
			this.color = Color.YELLOW;
			break;
		case 3 :
			this.color = Color.RED;
			break;
		case 4 :
			this.color = Color.PINK;
			break;
		}
		this.dp = dp;
	}

	public void startGame(int idPlayer) {}

	public void updateTower(int id, int idPlayer, int x, int y) {
		bw.getTower_manager().addTower(id, idPlayer, x, y);
	}
	
	public void updateTower(int id, int rate, int range, int life, int velocity) {
		bw.upgradeTower(id, rate, range, life, velocity);
	}

	public void setDestBase(int src, int dest) {
		dp.setDestBase(src, dest);
	}
	
	public void updateDestBase(int src, int dest) {
		bw.setDestBase(src, dest);
	}	

	public boolean upgradeTower(int id, int rate, int range, int life, int velocity) {
		dp.upgradeTower(id, rate, range, life, velocity);
		return false;

	}

	public boolean addTower(int id, int idPlayer, int x, int y) {
		dp.addTower(id, idPlayer, x, y);
		return false;
	}


	public InterfaceDispatcher getDp() {
		return dp;
	}
	
	public void setDp(InterfaceDispatcher dp) {
		this.dp = dp;
	}

	public BattleWar getBw() {
		return bw;
	}
	
	public void setBw(BattleWar bw) {
		this.bw = bw;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Color getColor() {
		return color;
	}

	public void setColor(Color color) {
		this.color = color;
	}

	public int getMoney() {
		return money;
	}

	public void setMoney(int money) {
		this.money = money;
	}

	public String getPseudo() {
		return pseudo;
	}

	public void setPseudo(String pseudo) {
		this.pseudo = pseudo;
	}
	
}
